package com.jack.base.desiginmodel.adapter;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by zhang_j on 2019/12/18
 */
public class MediaPlayerImpl implements MediaPlayer {

    @Override
    public void play(String mediaType, String name) {
        MediaAdapter mediaAdapter = new MediaAdapter(mediaType);
        if("mp3".equalsIgnoreCase(mediaType)){
            System.out.println(mediaType+name);
        }else if("mp4".equalsIgnoreCase(mediaType)||"vl".equalsIgnoreCase(mediaType)){
            mediaAdapter.play(mediaType,name);
        }else{
            System.out.println("unknown media type"+mediaType+name);
        }
    }

    public static void main(String[] args) {
//        MediaPlayer mediaPlayer = new MediaPlayerImpl();
//        mediaPlayer.play("mp3","mp3");
//        mediaPlayer.play("mp4","mp4");
//        mediaPlayer.play("vl","vl");
//        mediaPlayer.play("avi","avi");
        List<Integer> list = Lists.newArrayList(1,2,3,4);
        list = list.stream().filter(i->i==2).collect(Collectors.toList());
        System.out.println(list.toString());
    }
}
